﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EasyStep.Attributes;
using EasyStep.TestExecution.Data;
using EasyStep.TestExecution.Interfaces;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.Common.UnitTesting;


namespace EasyStep.TestActions.Actions
{
    [TestAction(typeof(AssertAction), Name = "ByText", RequireData = true, RequireLocator = false)]
    class AssertByText : ITestAction<Manager>
    {
        public void Execute(Manager browser, TestStepResult data, IExecuteDataContext context)
        {
            var c = new HtmlControl(browser.ActiveBrowser.Find.ByContent(data.Locator));
            if (c == null) throw new ArgumentNullException("can't find element by content:" + data.Locator);
            Assert.IsTrue(c.IsVisible());
        }
    }
}